package com.pie4cloud.pie.bus.api.dto;

import java.text.DecimalFormat;

public class ConsumerInfo {

    private String topic;

    private String groupId;

    private long totalLag;

    private double ratio;

    private long speedLogSize;

    private long speedOffset;

    private double delayDay;

    private String time;

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public DecimalFormat getDecimalFormat() {
        return decimalFormat;
    }

    private final DecimalFormat decimalFormat = new DecimalFormat("0.00");

    public double getDelayDay() {
        if (speedLogSize > 0) {
            delayDay = totalLag / (speedLogSize * 3600 * 24 * 1.0);
            delayDay = Double.parseDouble(decimalFormat.format(delayDay));
            return delayDay;
        } else {
            return 0;
        }
    }

    public void setDelayDay(double delayDay) {
        this.delayDay = delayDay;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public long getTotalLag() {
        return totalLag;
    }

    public void setTotalLag(long totalLag) {
        this.totalLag = totalLag;
    }

    public double getRatio() {
        return ratio;
    }

    public void setRatio(double ratio) {
        this.ratio = ratio;
    }

    public long getSpeedLogSize() {
        return speedLogSize;
    }

    public void setSpeedLogSize(long speedLogSize) {
        this.speedLogSize = speedLogSize;
    }

    public long getSpeedOffset() {
        return speedOffset;
    }

    public void setSpeedOffset(long speedOffset) {
        this.speedOffset = speedOffset;
    }

    public ConsumerInfo(String topic, String groupId, long totalLag, double ratio, long speedLogSize, long speedOffset, String time) {
        this.topic = topic;
        this.groupId = groupId;
        this.totalLag = totalLag;
        this.ratio = ratio;
        this.speedLogSize = speedLogSize;
        this.speedOffset = speedOffset;
        this.time = time;
    }
}
